package com.followmeandroid.tests;

import android.content.Intent;
import android.test.ActivityUnitTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.Button;

import com.followmeandroid.MainActivity;
import com.followmeandroid.R;

/**
 * Created by Nicholas on 11/25/2014.
 */
public class MainActivityTests extends ActivityUnitTestCase<MainActivity> {

    Intent mLaunchIntent;

    public MainActivityTests(){
        super(MainActivity.class);
    }
   
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        mLaunchIntent = new Intent(getInstrumentation().getTargetContext(), MainActivity.class);
        startActivity(mLaunchIntent, null, null);
    }

    @MediumTest
    public void testMapsWasStartedWithIntent(){
        final Button mapsButton = (Button)getActivity().findViewById(R.id.buttonNewMap);
        mapsButton.performClick();

        final Intent launchIntent = getStartedActivityIntent();
        assertNotNull("Intent was null", launchIntent);
    }

    @MediumTest
    public void testViewFriendsWasStartedWithIntent(){
        final Button friendsButton = (Button)getActivity().findViewById(R.id.buttonNewViewFriends);
        friendsButton.performClick();

        final Intent launchIntent = getStartedActivityIntent();
        assertNotNull("Intent was null", launchIntent);
    }

    @MediumTest
    public void testViewSettingsWasStartedWithIntent(){
        final Button settingsButton = (Button)getActivity().findViewById(R.id.buttonNewViewSettings);
        settingsButton.performClick();

        final Intent launchIntent = getStartedActivityIntent();
        assertNotNull("Intent was null", launchIntent);
    }

    @MediumTest
    public void testLocationsWasStartedWithIntent(){
        final Button locationsButton = (Button)getActivity().findViewById(R.id.buttonNewViewCurrentLocation);
        locationsButton.performClick();

        final Intent launchIntent = getStartedActivityIntent();
        assertNotNull("Intent was null", launchIntent);
    }

    @Override
    protected void tearDown() throws Exception {

        super.tearDown();
    }
}
